﻿/// <reference path="Meres.js" />

schedulerView = function () {

    this.installPluggin = function () {
        installjQueryPlugin();
        installdhxmlPlugin();
    }

    this.installPluggin();
    var myscheduler = undefined;

    function installjQueryPlugin() {
        $('.schedulerView').layout({
            center: {
                onresize: function () {
                    //log(myscheduler);
                    //installdhxmlPlugin();
                    
                }
            }
        });
    }

    function installdhxmlPlugin() {
        //        $(".schedulerView").jXamlGrid({
        //            gridDef: gridDefs[5]
        //        });


        scheduler.config.multi_day = true;
        scheduler.config.xml_date = "%Y-%m-%d %H:%i";
        myscheduler = scheduler.init('scheduler_here', new Date(2010, 7, 5), "week");
        scheduler.load("/Modules/Eking.Framework/Styles/dhtmlx/events2010.xml");

        var sections = [
			{ key: 1, label: "James Smith" },
			{ key: 2, label: "John Williams" },
			{ key: 3, label: "David Miller" },
			{ key: 4, label: "Linda Brown" }
		];

        scheduler.createTimelineView({
            name: "timeline",
            x_unit: "minute",
            x_date: "%H:%i",
            x_step: 30,
            x_size: 24,
            x_start: 16,
            x_length: 48,
            y_unit: sections,
            y_property: "section_id",
            render: "bar"

        });

        var calendar = scheduler.renderCalendar({
            container: "cal_here",
            navigation: true,
            handler: function (date) {
                scheduler.setCurrentView(date, scheduler._mode);
            }

        });
        scheduler.linkCalendar(calendar);
    }

}
